package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.OrderFormService;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import com.atguigu.spzx.model.vo.order.OrderVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "订单信息")
@RestController
@RequestMapping(value = "/orderform")
public class OrderFormController {

    @Autowired
    private OrderFormService orderFormService;

    @GetMapping("/getallorder")
    public Result<OrderVo> GetAllOrder(){
        List<OrderVo> list = orderFormService.GetAllOrder();
        return Result.build(list, ResultCodeEnum.SUCCESS);
    }

    @DeleteMapping("/deleteorder/{id}")
    public Result DeleteOrder(@PathVariable Long id){
        orderFormService.DeleteOrder(id);
        return Result.build(null,ResultCodeEnum.SUCCESS);
    }
}
